package com.oh.core.common.constant;

/**
 * 指令
 */
public enum CommandEnum {

    HEART_BEAT((byte)0, "心跳包"),
    LOGIN_REQUEST((byte)1, "登录指令"),
    MESSAGE_REQUEST((byte)2, "消息");
    // 成员变量
    private final byte command;
    private final String msg;
    // 构造方法  
    private CommandEnum(byte command, String msg) {  
        this.command = command;
        this.msg = msg;
    }

    // 普通方法  
    public static String getName(byte command) {
        for (CommandEnum c : CommandEnum.values()) {
            if (c.getCommand() == command) {
                return c.msg;
            }
        }
        return null;
    }

    public byte getCommand(){
        return this.command;
    }

    public String getMsg(){
        return msg;
    }
}